load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "restore",
    srcs = [
        "batcher.go",
        "client.go",
        "data.go",
        "db.go",
        "import.go",
        "import_retry.go",
        "log_client.go",
        "logutil.go",
        "merge.go",
        "pipeline_items.go",
        "range.go",
        "rawkv_client.go",
        "search.go",
        "split.go",
        "stream_metas.go",
        "systable_restore.go",
        "util.go",
    ],
    importpath = "github.com/pingcap/tidb/br/pkg/restore",
    visibility = ["//visibility:public"],
    deps = [
        "//br/pkg/checkpoint",
        "//br/pkg/checksum",
        "//br/pkg/common",
        "//br/pkg/conn",
        "//br/pkg/conn/util",
        "//br/pkg/errors",
        "//br/pkg/glue",
        "//br/pkg/logutil",
        "//br/pkg/metautil",
        "//br/pkg/pdutil",
        "//br/pkg/redact",
        "//br/pkg/restore/ingestrec",
        "//br/pkg/restore/prealloc_table_id",
        "//br/pkg/restore/split",
        "//br/pkg/restore/tiflashrec",
        "//br/pkg/rtree",
        "//br/pkg/storage",
        "//br/pkg/stream",
        "//br/pkg/summary",
        "//br/pkg/utils",
        "//br/pkg/utils/iter",
        "//br/pkg/version",
        "//config",
        "//ddl",
        "//ddl/util",
        "//domain",
        "//domain/infosync",
        "//kv",
        "//meta",
        "//parser/model",
        "//parser/mysql",
        "//sessionctx/variable",
        "//statistics/handle",
        "//store/helper",
        "//store/pdtypes",
        "//tablecodec",
        "//util",
        "//util/codec",
        "//util/collate",
        "//util/hack",
        "//util/mathutil",
        "//util/sqlexec",
        "//util/table-filter",
        "@com_github_emirpasic_gods//maps/treemap",
        "@com_github_fatih_color//:color",
        "@com_github_go_sql_driver_mysql//:mysql",
        "@com_github_google_uuid//:uuid",
        "@com_github_opentracing_opentracing_go//:opentracing-go",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_pingcap_kvproto//pkg/errorpb",
        "@com_github_pingcap_kvproto//pkg/import_sstpb",
        "@com_github_pingcap_kvproto//pkg/kvrpcpb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_kvproto//pkg/pdpb",
        "@com_github_pingcap_kvproto//pkg/recoverdatapb",
        "@com_github_pingcap_log//:log",
        "@com_github_tikv_client_go_v2//config",
        "@com_github_tikv_client_go_v2//kv",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//rawkv",
        "@com_github_tikv_client_go_v2//tikv",
        "@com_github_tikv_client_go_v2//txnkv/rangetask",
        "@com_github_tikv_pd_client//:client",
        "@org_golang_google_grpc//:grpc",
        "@org_golang_google_grpc//backoff",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//credentials",
        "@org_golang_google_grpc//credentials/insecure",
        "@org_golang_google_grpc//keepalive",
        "@org_golang_google_grpc//status",
        "@org_golang_x_exp//slices",
        "@org_golang_x_sync//errgroup",
        "@org_uber_go_multierr//:multierr",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "restore_test",
    timeout = "short",
    srcs = [
        "batcher_test.go",
        "client_test.go",
        "data_test.go",
        "db_test.go",
        "import_retry_test.go",
        "log_client_test.go",
        "main_test.go",
        "merge_fuzz_test.go",
        "merge_test.go",
        "range_test.go",
        "rawkv_client_test.go",
        "search_test.go",
        "split_test.go",
        "stream_metas_test.go",
        "systable_restore_test.go",
        "util_test.go",
    ],
    embed = [":restore"],
    flaky = True,
    race = "off",
    shard_count = 50,
    deps = [
        "//br/pkg/backup",
        "//br/pkg/conn",
        "//br/pkg/errors",
        "//br/pkg/glue",
        "//br/pkg/gluetidb",
        "//br/pkg/logutil",
        "//br/pkg/metautil",
        "//br/pkg/mock",
        "//br/pkg/pdutil",
        "//br/pkg/restore/split",
        "//br/pkg/restore/tiflashrec",
        "//br/pkg/rtree",
        "//br/pkg/storage",
        "//br/pkg/stream",
        "//br/pkg/utils",
        "//br/pkg/utils/iter",
        "//infoschema",
        "//kv",
        "//meta/autoid",
        "//parser/model",
        "//parser/mysql",
        "//parser/types",
        "//sessionctx/stmtctx",
        "//store/pdtypes",
        "//tablecodec",
        "//testkit",
        "//testkit/testsetup",
        "//types",
        "//util/codec",
        "//util/table-filter",
        "@com_github_fsouza_fake_gcs_server//fakestorage",
        "@com_github_golang_protobuf//proto",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@com_github_pingcap_kvproto//pkg/brpb",
        "@com_github_pingcap_kvproto//pkg/encryptionpb",
        "@com_github_pingcap_kvproto//pkg/errorpb",
        "@com_github_pingcap_kvproto//pkg/import_sstpb",
        "@com_github_pingcap_kvproto//pkg/metapb",
        "@com_github_pingcap_kvproto//pkg/pdpb",
        "@com_github_pingcap_kvproto//pkg/recoverdatapb",
        "@com_github_pingcap_log//:log",
        "@com_github_stretchr_testify//assert",
        "@com_github_stretchr_testify//require",
        "@com_github_tikv_client_go_v2//oracle",
        "@com_github_tikv_client_go_v2//rawkv",
        "@com_github_tikv_client_go_v2//testutils",
        "@com_github_tikv_pd_client//:client",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//keepalive",
        "@org_golang_google_grpc//status",
        "@org_golang_x_exp//slices",
        "@org_uber_go_goleak//:goleak",
        "@org_uber_go_multierr//:multierr",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)
